package Day08;

import java.util.Scanner;

public class GirlText {
    public static void main(String[] args) {
        Girl[] arr = new Girl[4];
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < arr.length; i++) {
            Girl g = new Girl();
            System.out.println("敢问菇凉芳名？");
            String name = sc.next();
            g.setName(name);

            System.out.println("敢问菇凉芳龄?");
            int age = sc.nextInt();
            g.setAge(age);

            System.out.println("敢问菇凉平时可有爱好?");
            String hobby = sc.next();
            g.setHobby(hobby);

            System.out.println("敢问菇凉的 类型是?");
            String gender = sc.next();
            g.setGender(gender);

            arr[i] = g;
        }

        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            sum += arr[i].getAge();
        }
        int avg = sum / arr.length;

        for (int i = 0; i < arr.length; i++) {
            Girl g1 = arr[i];
            if(g1.getAge() < avg ){
                System.out.println("低于平均年龄的有:"+ g1.getName() + ","
                        + g1.getAge() + "," + g1.getGender() + ", " + g1.getHobby());
            }
        }
    }
}
